﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class EShop_BuyPoint : System.Web.UI.Page
{
    BaoKimPayment BK = new BaoKimPayment();
    security baomat = new security();
    NL_Checkout Nganluong = new NL_Checkout();
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    // thanh toan qua ngan luong
    protected void btnNLService_Click(object sender, EventArgs e)
    {
        string madonhang = Page.RouteData.GetRequiredString("user");
        string total_amount = baomat.sotien(Page.RouteData.GetRequiredString("money"));
        string urlSuccess = Server.MapPath("EShop/nganluong/done/" + madonhang + "/" + total_amount + "/complete.html");
        string receiver = "duongdangquoc@gmail.com"; //email nhan tien da dang ki tai ngan luong.
        string transaction_info = "Mua điểm qua dịch vụ Ngân lượng";
        string order_code = DateTime.Now.Day+"_"+DateTime.Now.Month+"_"+DateTime.Now.Year;
        string redirectURL = Nganluong.buildCheckoutUrl(urlSuccess, receiver, transaction_info, order_code, total_amount);
        Response.Redirect(redirectURL);
    }
    // thanh toan qua bao kim
    protected void btnBKService_Click(object sender, EventArgs e)
    {
        string madonhang = Page.RouteData.GetRequiredString("user");//userID
        string BuyerEmail = "duongdangquoc@gmail.com"; // khai bao email nguoi ban
        string total_amount = baomat.sotien(Page.RouteData.GetRequiredString("money"));
        string shippingFee = "0";
        string tax = "";
        string order_description = "Mua điểm qua dịch vụ bảo kim";
        string urlSuccess = Server.MapPath("EShop/baokim/done/" + madonhang + "/" + total_amount + "/complete.html");
        string urlFail = Server.MapPath("EShop/baokim/fail/" + madonhang + "/" + total_amount + "/complete.html");
        string redirectURL = BK.createRequestUrl(madonhang, BuyerEmail, total_amount, shippingFee, tax, order_description, urlSuccess, urlFail, "");
        Response.Redirect(redirectURL);
    }
}